﻿function StringLengthValidatorEvaluateIsValid(val) {
    var value = ValidatorTrim(ValidatorGetValue(val.controltovalidate).toString());
    if (value.length == 0)
    {
        return false;
    }

    var max = true, min = true;
    if (("MaxLength" in val) && val.MaxLength >= 0 && value.length > val.MaxLength) 
    {
        max = false;
    }

    if (("MinLength" in val) && val.MinLength >= 0 && value.length < val.MinLength) {
        min = false;
    }

    return max & min;
}